<?php

class Core_Form_Admin_Settings_Base extends Form
{

	public function doCommit()
	{
		$data = $this -> getValues();
		Nuo::getTable('core@setting') -> set($data);
	}

	public function beforeRender()
	{
		$table = Nuo::getTable('core@setting');
		$siteId = Nuo::getSiteId();

		foreach ($this->_elements as $name => $element)
		{
			if ($element instanceof Html_Element_Field && strpos($name, '_'))
			{

				$value = $table -> get($name, null, $siteId);
				if (null !== $value)
				{
					$element -> setValue($value);
				}
			}
		}
	}

}
